package org.linlinjava.litemall.db.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.linlinjava.litemall.db.dao.GoodsAttributeMapper;
import org.linlinjava.litemall.db.models.GoodsAttribute;
import org.linlinjava.litemall.db.service.GoodsAttributeService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsAttributeServiceImpl extends ServiceImpl<GoodsAttributeMapper, GoodsAttribute>
        implements GoodsAttributeService {

    @Override
    public List<GoodsAttribute> queryByGid(Long goodsId) {
        QueryWrapper<GoodsAttribute> query = new QueryWrapper<>();
        query.eq("goods_id", goodsId);
        return baseMapper.selectList(query);
    }

    @Override
    public void deleteByGid(Long gid) {
        QueryWrapper<GoodsAttribute> query = new QueryWrapper<>();
        query.eq("goods_id", gid);
        baseMapper.delete(query);
    }

}
